package net.zoneland.knowledge.utils;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;

public class DoubleList {
    public static void main(String[] args) {
        List<String> names = Arrays.asList("张三", "李四", "方烨", "李舟");
        List<String> uids = Arrays.asList("zs", "ls", "fangye", "lizhou");

/*        Map<Integer, String> nameMap = new HashMap<>();
        for(ListIterator<String> lt = names.listIterator(); lt.hasNext(); ) {
            nameMap.put(lt.nextIndex(), lt.next());
        }

        for(ListIterator<String> lt = uids.listIterator(); lt.hasNext(); ) {
            int index = lt.nextIndex();
            System.out.printf("index[%d]uid[%s]name[%s]\r\n", index, lt.next(), nameMap.get(index));
        }*/

        for(ListIterator<String> lt1 = names.listIterator(), lt2 = uids.listIterator(); lt1.hasNext() && lt2.hasNext(); ) {
            int index = lt1.nextIndex();
            System.out.printf("index[%d]uid[%s]name[%s]\r\n", index, lt2.next(), lt1.next());
        }
    }
}
